<include file="/public/header" />
<div class="layui-fluid">
    <div class="layui-card">
        <!-- // 默认操作按钮 -->
        <div class="layui-card-header layadmin-card-header-auto ">
            <div class="layui-form">
                <div class="layui-form-item">

                <div class="layui-inline">
                    <div class="layui-input-inline ">
                        <select name="status">
                            <option value="">{:__('按状态查看')}</option>
                            <option value="2">{:__('已审核')}</option>                                 
                            <option value="1">{:__('未审核')}</option>                             
                        </select>
                    </div>
                </div>

                <div class="layui-inline">
                    <div class="layui-input-inline ">
                        <input name="name" class="layui-input" type="text" placeholder="{:__('关键字查询')}"/>
                    </div>
                </div>
                <div class="layui-inline" >
                    <!-- // 默认搜索 -->
                    <button class="layui-btn icon-btn" lay-filter="formSearch" lay-submit><i class="layui-icon layui-icon-search"></i>{:__('搜索')}</button>
                    <!-- // 添加数据页面 -->
                    <button class="layui-btn icon-btn" lay-open="" data-title="{:__('添加索引')}" data-area="695px" data-url="#editforms" >
                        <i class="layui-icon layui-icon-add-1"></i>{:__('添加')}
                    </button>
                </div>
                </div>
            </div>   
        </div>        

        <!-- // 创建数据表实例 -->
        <table id="lay-tableList" lay-filter="lay-tableList"></table>        
    </div>
</div>

<!-- // 添加编辑数据 -->
<script type="text/html" id="editforms" >
<div class="layui-fluid layui-bg-white" >
    <form class="layui-form layui-form-fixed" lay-filter="editforms" >
    <input type="text" name="id" hidden="">
    <div class="layui-form-item">
        <label class="layui-form-label"><font color="red">* </font>{:__('索引类型')}</label>
        <div class="layui-input-inline">
            <select name="type" lay-verify="required" data-disabled>
                <option value="">请选择</option>
                <option value="XunSearch">XunSearch</option>
                <option value="ElasticSearch">ElasticSearch</option>
            </select>
        </div>
        <label class="layui-form-label"><font color="red">* </font>{:__('索引服务器')}</label>
        <div class="layui-input-inline">
            <input name="index" placeholder="{:__('192.168.220.101:8383')}" type="text" class="layui-input" lay-verify="required" />
        </div>

    </div>    
    <div class="layui-form-item">
        <label class="layui-form-label"><font color="red">* </font>{:__('项目名称')}</label>
        <div class="layui-input-inline">
            <input name="name" placeholder="{:__('请输入项目检索名')}" type="text" class="layui-input" lay-verify="required" />
        </div>
        <label class="layui-form-label"><font color="red">* </font>{:__('搜索服务器')}</label>
        <div class="layui-input-inline">
            <input name="search" placeholder="{:__('192.168.220.101:8384')}" type="text" class="layui-input" />
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">{:__('用户名')}</label>
        <div class="layui-input-inline">
            <input name="username" placeholder="{:__('可选')}" type="text" class="layui-input" />
        </div>
        <label class="layui-form-label">{:__('服务器密码')}</label>
        <div class="layui-input-inline">
            <input name="password" placeholder="{:__('可选')}" class="layui-input" />
        </div>
    </div>
    <!-- // 配置字段 -->
    <div class="layui-footer layui-form-item layui-center "  >
        <button class="layui-btn layui-btn-primary" type="button" sa-event="closePageDialog" >{:__('取消')}</button>
        <button class="layui-btn" lay-filter="submitPage"  lay-submit>{:__('提交')}</button>
    </div>
    </form>
</div>
</script>

<!-- // 列表工具栏 -->
<script type="text/html" id="tableBar"> 
    <a class="layui-table-text" data-title="{:__('编辑索引')}" data-area="695px" data-url="#editforms" lay-event="edit">{:__('编辑')}</a>
    <div class="layui-divider layui-divider-vertical"></div>
    <a class="layui-table-text" lay-open="" data-title="{:__('编辑字段')}" data-area="850px,680px" 
    data-url="{:url('/system.fulltext/fields')}?id={{d.id}}&type={{d.type}}" >{:__('字段')}</a>
    <div class="layui-divider layui-divider-vertical"></div>
    <a class="layui-table-text" data-url="{:url('/system.fulltext/del')}?id={{d.id}}&type={{d.type}}" lay-event="del">{:__('删除')}</a>
</script>

<include file="/public/footer" />
<script>
    layui.use(['table'], function () {

        var table = layui.table;
        /*
         * 初始化表格
        */
        var isTable = table.render({
            elem: "#lay-tableList"
            ,url: "{:url('/system.fulltext/index')}"
            ,page: true
            ,limit: 18
            ,cols: [[
                {type: 'checkbox', width:45},
                {field: 'id', align: 'center',sort: true,width: 80,  title: 'ID'},
                {field: 'name', align: 'left',width: 160,  title: '{:__("名称")}'},
                {field: 'field', align: 'center', title: '{:__("字段")}'},
                {field: 'type', align: 'left', width: 160, title: '{:__("类型")}'},
                {field: 'createtime', align: 'center', width:180, title: '{:__("创建时间")}'},
                {align: 'center', toolbar: '#tableBar', width:220, title: '{:__("操作")}'},
            ]]
        })

    })
</script>
